<template>
	<view>
		<u-swiper :list="lun" @click="tuxian" :height="200" :effect3d="true" :title="true"></u-swiper>
		<uni-group title="全部服务">
			<view class="item-container">
				<view class="thumb-box" v-for="(item1, index1) in lun2" @click="dianji(item1.link)" :key="index1">
					<image class="item-menu-image" :src="item1.image" mode=""></image>
					<view class="item-menu-name">{{item1.title}}</view>
				</view>
			</view>
		</uni-group>
		<uni-group title="扶贫案例">
			<view class="comment" v-for="(res, index) in commentList" :key="res.id">
				<view class="left">
					<image :src="res.url" mode="aspectFill"></image>
				</view>
				<view class="right">
					<view class="top">
						<view class="name">{{ res.name }}</view>
						<view class="like" :class="{ highlight: res.isLike }">
							<view class="num">{{ res.likeNum }}</view>
							<u-icon v-if="!res.isLike" name="thumb-up" :size="30" color="#9a9a9a"
								@click="getLike(index)"></u-icon>
							<u-icon v-if="res.isLike" name="thumb-up-fill" :size="30" @click="getLike(index)"></u-icon>
						</view>
					</view>
					<view class="content">
						“吃饭莫忘种田人，吃水不忘挖井人，非常感谢常德联通驻村工作队人员的辛勤付出”。近日，常德汉寿县洞庭村村委一行5人，将一面写有“联通扶贫用真情
						洞庭人民永记心”的锦旗专程送到常德联通，党委委员周海华同志代表全
					</view>

					<view class="bottom">
						{{ res.date }}

					</view>
				</view>
			</view>
		</uni-group>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				commentList: [],
				lun2: [{
						image: '../../../static/zhihui/hospital2.png',
						title: '村情村貌',
						link: 'cun'
					},
					{
						image: '../../../static/zhihui/hospital-21.png',
						title: '收到求助',
						link: 'qiu'
					},
					{
						image: '../../../static/zhihui/hospital-27.png',
						title: '入户走访',
						link: 'ru'
					},
					{
						image: '../../../static/zhihui/hospital-27.png',
						title: '案例发布',
						link: 'an'
					}
				],
				lun: [{
						image: '../../../static/zhihui/hospital2.png',
						title: '致力于农村基础设施建设，瑞因智控获百万级别种子轮投'
					},
					{
						image: '../../../static/zhihui/hospital-21.png',
						title: '开阳信息锁进：饮水思源，精准扶贫'
					},
					{
						image: '../../../static/zhihui/hospital-27.png',
						title: '常德联通：精准扶贫暖人心 感恩帮扶送锦旗'
					}
				]
			}
		},
		onLoad() {
			this.getComment();
		},
		methods: {
			tuxian(){
				uni.navigateTo({
					url:'xianqq'
				})
			},
			dianji(url){
				uni.navigateTo({
					url:url
				})
			},
			toAllReply() {
				uni.navigateTo({
					url: '/pages/template/comment/reply'
				});
			},
			// 点赞
			getLike(index) {
				this.commentList[index].isLike = !this.commentList[index].isLike;
				if (this.commentList[index].isLike == true) {
					this.commentList[index].likeNum++;
				} else {
					this.commentList[index].likeNum--;
				}
			},
			// 评论列表
			getComment() {
				this.commentList = [{
						id: 1,
						name: '叶轻眉',
						date: '12-25 18:58',
						contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
						url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
						allReply: 12,
						likeNum: 33,
						isLike: false,
						replyList: [{
								name: 'uview',
								contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
							},
							{
								name: '粘粘',
								contentStr: '今天吃什么，明天吃什么，晚上吃什么，我只是一只小猫咪为什么要烦恼这么多'
							}
						]
					},
					{
						id: 2,
						name: '叶轻眉1',
						date: '01-25 13:58',
						contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
						allReply: 0,
						likeNum: 11,
						isLike: false,
						url: 'https://cdn.uviewui.com/uview/template/niannian.jpg',
					},
					{
						id: 3,
						name: '叶轻眉2',
						date: '03-25 13:58',
						contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
						allReply: 0,
						likeNum: 21,
						isLike: false,
						allReply: 2,
						url: '../../../static/logo.png',
						replyList: [{
								name: 'uview',
								contentStr: 'uview是基于uniapp的一个UI框架，代码优美简洁，宇宙超级无敌彩虹旋转好用，用它！'
							},
							{
								name: '豆包',
								contentStr: '想吃冰糖葫芦粘豆包，但没钱5555.........'
							}
						]
					},
					{
						id: 4,
						name: '叶轻眉3',
						date: '06-20 13:58',
						contentText: '我不信伊朗会没有后续反应，美国肯定会为今天的事情付出代价的',
						url: 'https://cdn.uviewui.com/uview/template/SmilingDog.jpg',
						allReply: 0,
						likeNum: 150,
						isLike: false
					}
				];
			}
		},
	}
</script>

<style lang="scss" scoped>
	.item-container {
		display: flex;
		flex-wrap: wrap;
	}

	.thumb-box {
		width: 25%;
		
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 20rpx;
	}

	.item-menu-image {
		border-radius: 50%;
		width: 120rpx;
		height: 120rpx;
	}

	.comment {
		display: flex;
		padding: 30rpx;

		.left {
			image {
				width: 64rpx;
				height: 64rpx;
				border-radius: 50%;
				background-color: #f2f2f2;
			}
		}

		.right {
			flex: 1;
			padding-left: 20rpx;
			font-size: 30rpx;

			.top {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 10rpx;

				.name {
					color: #5677fc;
				}

				.like {
					display: flex;
					align-items: center;
					color: #9a9a9a;
					font-size: 26rpx;

					.num {
						margin-right: 4rpx;
						color: #9a9a9a;
					}
				}

				.highlight {
					color: #5677fc;

					.num {
						color: #5677fc;
					}
				}
			}

			.content {
				margin-bottom: 10rpx;
			}

			.reply-box {
				background-color: rgb(242, 242, 242);
				border-radius: 12rpx;

				.item {
					padding: 20rpx;
					border-bottom: solid 2rpx $u-border-color;

					.username {
						font-size: 24rpx;
						color: #999999;
					}
				}

				.all-reply {
					padding: 20rpx;
					display: flex;
					color: #5677fc;
					align-items: center;

					.more {
						margin-left: 6rpx;
					}
				}
			}

			.bottom {
				margin-top: 20rpx;
				display: flex;
				font-size: 24rpx;
				color: #9a9a9a;

				.reply {
					color: #5677fc;
					margin-left: 10rpx;
				}
			}
		}
	}
</style>
